package com.lpf;

import com.lpf.mybatis.beans.Test;
import com.lpf.mybatis.config.mappers.TestMapper;
import com.lpf.mybatis.executor.ExecutorFactory;
import com.lpf.mybatis.config.Configuration;
import com.lpf.mybatis.session.SqlSession;

public class BootStrap {

    public static void main(String[] args) {
        start();
    }

    private static void start() {

        Configuration configuration = new Configuration();
        configuration.setScanPath("com.lpf.mybatis.config.mappers");
        configuration.build();

        //SqlSession sqlSession = new SqlSession(configuration, ExecutorFactory.DEFAULT(configuration));
        SqlSession sqlSession = new SqlSession(configuration, ExecutorFactory.get(ExecutorFactory.ExecutorType.CACHING.name(), configuration));

        TestMapper testMapper = sqlSession.getMapper(TestMapper.class);

        Test test = testMapper.selectByPrimaryKey(1);
        System.out.println(test);

        test = testMapper.selectByPrimaryKey(1);
        System.out.println(test);
    }
}